package com.shiwaixiangcun.authz.shiro.oauth;

import org.apache.shiro.authc.RememberMeAuthenticationToken;

public class OAuth2Token implements RememberMeAuthenticationToken {

    // the service access_token
    private String accessToken;

    // the user identifier, username
    private String account;

    // is the user in a remember me mode ?
    private boolean rememberMe = false;


    private String resourceId;


    public OAuth2Token(String accessToken, String resourceId) {
        this.accessToken = accessToken;
        this.resourceId = resourceId;
    }


    @Override
    public boolean isRememberMe() {
        return rememberMe;
    }

    public OAuth2Token setAccount(String account) {
        this.account = account;
        return this;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getAccount() {
        return account;
    }

    public String getResourceId() {
        return resourceId;
    }

    public void setResourceId(String resourceId) {
        this.resourceId = resourceId;
    }

    public OAuth2Token setRememberMe(boolean rememberMe) {
        this.rememberMe = rememberMe;
        return this;
    }

    @Override
    public Object getPrincipal() {
        return account;
    }

    @Override
    public Object getCredentials() {
        return accessToken;
    }
}
